package cantelarMario.model;

import java.util.List;
import cantelarMario.model.bo.Persona;
import org.hibernate.Transaction;

public class PersonaDAO extends DAObase {
	public void insertarPersona(Persona persona) {
		Transaction t = session.beginTransaction();
		session.save(persona);
		t.commit();
	}

	public List<Persona> getTodasPersonas() {
		Transaction t = session.beginTransaction();
		@SuppressWarnings("unchecked")
		List<Persona> listaPersonas = session.createQuery("from Persona")
				.list();
		t.commit();

		return listaPersonas;
	}

	public void guardar(Persona persona) {
		Transaction t = session.beginTransaction();
		session.merge(persona);
		t.commit();
	}
}
